package com.xzp.ch06.anno;

import com.xzp.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
@Select("select * from user where id=#{id}")
    public User selectUserById(Integer id);
@Select("select * from user where name like concat ('%'),#{name},'%')")
    public List<User> selectList(String name);

@Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
@Insert("select into user(name,age,gender,birthday,state)values (#(name),#(age), #(gender),#(birthday),#(state))")
    public int insert(User user);


   @Update("update user set state=#{state} where id=#{id}")
    public int updateState(@Param("id")  int id,@Param("state") String state);



   @Delete("delete from user where id=#{id}")
    public int deleteById(Integer id);



}
